home *** CD-ROM | disk | FTP | other *** search
Wrap
;/* F_Create.rexx EXE String QUIT _________________________________________________________________________ Written by Olivier LAVIALE <HaploLaMain@aol.com> This demo shows how to use and customise FC_String objects. */ ///Header #include <libraries/feelin.h> #include <proto/exec.h> #include <proto/dos.h> #include <proto/graphics.h> #include <proto/feelin.h> struct FeelinBase *FeelinBase; #define GfxBase FeelinBase -> Graphics ///drawstri SAVEDS void drawstri(struct RastPort *rp,struct FeelinRect *rect,ULONG a,ULONG b) { WORD x1 = rect -> x1, x3 = rect -> x2, x2 = (x3 - x1) / 3 + x1, y1 = rect -> y1, y2 = rect -> y2; static UWORD pt[] = {0xFF00,0x7F80,0x3FC0,0x1FE0, 0x0FF0,0x07F8,0x03FC,0x01FE, 0x00FF,0x807F,0xC03F,0xE01F, 0xF00F,0xF807,0xFC03,0xFE01}; _APen(a); _BPen(b); rp -> AreaPtrn = pt; rp -> AreaPtSz = 4; _Boxf(x2+1,y1,x3,y2); rp -> AreaPtSz = 0; rp -> AreaPtrn = NULL; _APen(b); _Boxf(x1,y1,x2,y2); } //+ ///drawback F_HOOKM(void,drawback,FS_ImageDisplay_HookDraw) { drawstri(Msg -> Render -> RPort,Msg -> Region,Msg -> Render -> Palette -> Pens[FV_Pen_Fill],Msg -> Render -> Palette -> Pens[FV_Pen_HalfShadow]); } //+ ///drawcursor F_HOOKM(void,drawcursor,FS_ImageDisplay_HookDraw) { struct RastPort *rp = Msg -> Render -> RPort; WORD x1 = Msg -> Rect -> x1, x2 = Msg -> Rect -> x2, y1 = Msg -> Rect -> y1, y2 = Msg -> Rect -> y2; ULONG ap = Msg -> Render -> Palette -> Pens[FV_Pen_Shine], bp = Msg -> Render -> Palette -> Pens[FV_Pen_Shadow], cp = Msg -> Render -> Palette -> Pens[FV_Pen_HalfShine]; drawstri(rp,Msg -> Region,ap,cp); _APen(ap); _Move(x1+1,y2); _Draw(x2,y2); _Draw(x2,y1+1); _APen(bp); _Move(x1,y2-1); _Draw(x1,y1); _Draw(x2-1,y1); } //+ ///drawcursor2 F_HOOKM(void,drawcursor2,FS_ImageDisplay_HookDraw) { drawstri(Msg -> Render -> RPort,Msg -> Region,Msg -> Render -> Palette -> Pens[FV_Pen_Shine],Msg -> Render -> Palette -> Pens[FV_Pen_HalfShine]); } //+ ///drawblink F_HOOKM(void,drawblink,FS_ImageDisplay_HookDraw) { struct RastPort *rp = Msg -> Render -> RPort; WORD x1 = Msg -> Rect -> x1, x2 = Msg -> Rect -> x2, y1 = Msg -> Rect -> y1, y2 = Msg -> Rect -> y2; ULONG ap = Msg -> Render -> Palette -> Pens[FV_Pen_HalfShine], bp = Msg -> Render -> Palette -> Pens[FV_Pen_HalfDark], cp = Msg -> Render -> Palette -> Pens[FV_Pen_Fill]; drawstri(rp,Msg -> Region,ap,cp); _APen(ap); _Move(x1+1,y2); _Draw(x2,y2); _Draw(x2,y1+1); _APen(bp); _Move(x1,y2-1); _Draw(x1,y1); _Draw(x2-1,y1); } //+ static struct Hook hook_drawback[] = { NULL,NULL,(HOOKFUNC) drawback, NULL,NULL }; static struct Hook hook_drawcursor[] = { NULL,NULL,(HOOKFUNC) drawcursor, NULL,NULL }; static struct Hook hook_drawcursor2[] = { NULL,NULL,(HOOKFUNC) drawcursor2, NULL,NULL }; static struct Hook hook_drawblink[] = { NULL,NULL,(HOOKFUNC) drawblink, NULL,NULL }; static UBYTE __str[] = "Haplo is a lord"; static UBYTE __hex[] = "ABCDEFabcdef0123456789"; static UBYTE __num[] = "0123456789"; static UBYTE upstr[] = "<pens style=shadow>Yea baby !!"; #define String_(s,l) F_MakeObj(FV_MakeObj_String,s,l) //+ ///Main void main(void) { static char myback[16]; static char mycursor[16]; static char mycursor2[16]; static char myblink[16]; APTR app,win,str,txt; if (FeelinBase = (APTR) OpenLibrary("feelin.library",FV_VERSION)) { F_RawFormat(&myback, "H:%08lx",&hook_drawback); F_RawFormat(&mycursor, "H:%08lx",&hook_drawcursor); F_RawFormat(&mycursor2, "H:%08lx",&hook_drawcursor2); F_RawFormat(&myblink, "H:%08lx",&hook_drawblink); app = AppObject, Child, win = WindowObject, FA_Window_Title, "Feelin : Strings", FA_Window_Open, TRUE, Child, Page, Child, VGroup, FA_Group_Title, "Examples", Child, VGroup, GroupFrame, FA_Frame_Title, "Numeric", Child, StringObject, "FA_String_MaxLen",32, "FA_String_Accept",__num, "FA_String_Integer", 1234, End, End, Child, VGroup, GroupFrame, FA_Frame_Title, "Hexadecimal", Child, StringObject, "FA_String_MaxLen",80, "FA_String_Accept",__hex, "FA_String_Contents", "12a4BC", End, End, Child, VGroup, GroupFrame, FA_Frame_Title, "Alphabetic", Child, StringObject, "FA_String_Contents",__str, "FA_String_MaxLen",80, "FA_String_Reject",__num, "FA_String_Format",FV_String_Left, End, Child, StringObject, "FA_String_Contents",__str, "FA_String_MaxLen",80, "FA_String_Reject",__num, "FA_String_Format",FV_String_Center, End, Child, StringObject, "FA_String_Contents",__str, "FA_String_MaxLen",80, "FA_String_Reject",__num, "FA_String_Format",FV_String_Right, End, End, End, Child, VGroup, FA_SetMax, FV_SetMaxH, FA_Group_Title, "Custom", Child, F_NewObj(FC_String, FA_Font,"Garnet/16", "FA_String_Contents", __str, "FA_String_Format", FV_String_Left, "FA_String_BlinkSpeed", 10, End, Child, F_NewObj(FC_String, FA_Back, &myback, FA_Font, "Times/36", "FA_String_Contents", __str, "FA_String_Format", FV_String_Center, "FA_String_BlinkSpeed", 10, "FA_String_TextActive", "c:0044DD", "FA_String_TextInactive", "c:00277F", "FA_String_TextBlock", "c:0066EE", "FA_String_Cursor", &mycursor, "FA_String_Blink", &myblink, End, Child, F_NewObj(FC_String, FA_Back, &myback, FA_Font, "Diamond/20", "FA_String_Contents", __str, "FA_String_Format", FV_String_Right, "FA_String_Cursor", &mycursor2, "FA_String_TextBlock", "s:4", End, End, Child, VGroup, FA_Group_Title, "Notification", Child, TextObject, FA_SetMax,TRUE, DontChain, FA_Text_Shortcut,FALSE, FA_Text,"<align=justify><pens style=shadow>All modifications done in the<br>FC_String object below will be<br>reported to the FC_Text object.<hr>You can enter HTML formating<br>codes to adjust text.</pens><br>Try <pens style=ghost><stop><align=center></stop></pens> before your text.", End, Child, str = String_(upstr,256), Child, txt = TextObject, FA_Frame, "FP_Gauge_Frame", DontChain, FA_Inner_Left,3,FA_Inner_Top,2,FA_Inner_Right,3,FA_Inner_Bottom,2,FA_Font,"FP_Font_Big", FA_SetMax,FV_SetMaxH, FA_Text_Static,TRUE, /*FA_Text_PreParse,"`l`n`Sn`p0",*/ FA_Text,upstr, End, End, End, End, End; if (app) { F_Do(str,FM_Notify,F_DynamicFindID("FA_String_Contents"),FV_Notify_Always,txt,FM_Set,2,FA_Text,FV_Notify_Value); F_Do(win,FM_Notify,FA_Window_CloseRequest,TRUE,app,FM_Application_Shutdown,0); F_Do(app,FM_Application_Run); F_DisposeObj(app); } CloseLibrary(FeelinBase); } else Printf("Unable to open feelin.library\n"); } //+